package com.zhouwd.plugin


import org.gradle.api.Plugin
import org.gradle.api.Project

class ApkDistPlugin implements Plugin<Project> {

    @Override
    void apply(Project project) {
//        Person person = new Person()
//        person.name = "zhouwd"
//        person.age = 18
//        project.extensions.add("person", person)
//        println("Person --> " + project.person)
//        project.task('printPerson') {
//            println("Person -->1111111 " + project.person)
//            doLast {
//                Person ext = project.person
//                println ext
//            }
//        }
        Map<String, Project> projects = project.getChildProjects()
        println("projects -> $projects")
        projects.each {
            println("projects --> key -> $it.key -> value -> $it.value")
        }

        String projectDir = project.projectDir
        String projectName = project.name
        println("projectDir -> $projectDir ---> projectName -> $projectName")

        Project parentProject = project.getParent()
        String parentProjectName = parentProject.name

        String parentProjectDir = parentProject.projectDir

        println("parentProjectName -> $parentProjectName ---> parentProjectDir -> $parentProjectDir")

        //project.extensions.create("person", Person)
        project.tasks.create("TestTask", TestTask)


        project.configurations.each {
            String configName = it.name
            println("configName ---> $configName")
        }

    }
}